import React, { Component, PropTypes } from 'react';
import { Button, Menu, Dropdown, Icon, Select, Modal } from 'antd';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;
import MyFavourite from './index';
import FavouriteBrowser from '../public/index';

export default class Test extends Component {
  constructor(props) {
    super(props);
    this.state = {
      visible: false,
    };
  }

    openBrowser = () => {
      this.setState({ visible: true });
    }

    closeBrowser = () => {
      this.setState({ visible: false });
    }

    onSubmitBack = (result) => {
      // console.log(result);
    }

    render() {
      const { visible } = this.state;
      const favname = `${getLabel(33624, '留言')}`;
      const favouritetype = '2';
      const objid = 1;
      const importantlevel = 1;
      const onOpen = (v1, v2) => {
        //alert(`v1 : ${v1},v2 : ${v2}`);
      };
      const browserParams = { visible, favname, favouritetype, objid, importantlevel, onOpen };

      return (
        <div>
          <MyFavourite ecId={`${this && this.props && this.props.ecId || ''}_MyFavourite@fn3cas`}><Button ecId={`${this && this.props && this.props.ecId || ''}_Button@4t1g4b`}>收藏夹窗口</Button></MyFavourite>

          <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@gr5vwl`} onClick={this.openBrowser}>收藏</Button>

          <FavouriteBrowser ecId={`${this && this.props && this.props.ecId || ''}_FavouriteBrowser@zrsg2x`} {...browserParams} onClose={this.closeBrowser} submitBack={this.onSubmitBack} />
        </div>
      );
    }
}
